<template>
    <div class="school">
        <h2>学校名称:{{ name }}</h2>
        <h2>学校地址:{{ address }}</h2>
        <button @click="sendSchoolName">点我将学校名发送至App组件</button>
    </div>
</template>

<script>
import Vue from 'vue';
export default Vue.extend({
    name: 'Student',
    props: ['getSchoolName'],
    data() {
        return {
            name: "尚硅谷atguigu",
            address: "北京",
        }
    },
    methods: {
        sendSchoolName(){
            this.getSchoolName(this.name)
        },
    },
}) 
</script>

<style>
.school {
    background-color: skyblue;
    padding: 5px;
}
</style>